package com.cli.idempotent.model;

import com.cli.idempotent.constant.ResponseCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author xiongmin
 * @version 0.0.1
 * @description Created by work on 2021/10/31 2:35 下午
 * @see
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVo<T> {
    private int code;
    private String message;
    private T data;

    public ResultVo(int code, String message) {
        this.code = code;
        this.message = message;
    }



    public static ResultVo getFailedResult(int errorCode, String errorMsg) {
        return new ResultVo(errorCode,errorMsg);
    }

    public static ResultVo getSuccessResult(String businessResult) {
        return new ResultVo(ResponseCode.code_success,ResponseCode.SUCCESS,businessResult);
    }
}
